﻿using EquipmentAlarmSystem.Service.Library;
using Microsoft.AspNetCore.Mvc;

namespace EquipmentAlarmSystem.Controllers;


[ApiController]
[Route("[controller]/[action]")]
public class LicenseController : Controller
{
    private readonly ILogger<LicenseController> _logger;

    public LicenseController(ILogger<LicenseController> logger)
    {
        _logger = logger;
    }

    /// <summary>
    /// 短信验证
    /// </summary>
    /// <returns></returns>
    [HttpGet]
    public bool ObtainVerificationCode(string verificationCode)
    {
        string code = Basics.VerificationCode();

        if (code.Length >= 5)
        {
            if (verificationCode == code)
            {
                return true;
            }
        }
        return false;
    }

    /// <summary>
    /// 获取验证码
    /// </summary>
    /// <returns></returns>
    [HttpGet]
    public string SmsVerification()
    {
        return Basics.SendCode();
    }
}
